<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="path" value="${pageContext.request.contextPath}"/>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
table {
	margin: 0 auto;
	text-align: center;
	width: 50%;
	border-collapse: collapse;
}
td, th {
	border: 1px solid black;
}
#mytable {
	color: red;
	margin-bottom: 20px;
}
</style>
</head>
<body>
	success! <br>
	姓名：${name} <br>
	
	<div>
		<table id="mytable"></table>
	</div>
	
	<c:if test="${!empty list}">
	<div>		
		<table>
			<tr>
				<th>ID</th><th>类型名称</th><th>类型值</th>
			</tr>
			<c:forEach var="dict" items="${list}">
			<tr>
				<td>${dict.id}</td>
				<td>${dict.itemName}</td>
				<td>${dict.itemValue}</td>
			</tr>
			</c:forEach>
		</table>
	</div>
	</c:if>
	
	<script src="${path}/js/jquery-1.7.min.js"></script>
	<script>
	$(function() {
		$.getJSON('${path}/action/my/listDict', function(data) {
			$('#mytable').append('<tr><th>ID</th><th>类型名称</th><th>类型值</th></tr>');
			for(var i=0; i<data.length; i++) {
				var dict = data[i];
				$('#mytable').append('<tr><td>'+dict.id+'</td><td>'+dict.itemName+'</td><td>'+dict.itemValue+'</td></tr>');				
			}
		});	
	})
	</script>
</body>
</html>